from public.action import *
from public.tools import *
from public.testData import *
testCase = "DBshop021_添加品牌"
firefox=getDriver()
openBrowser(firefox,urlAdmin)
logInAdmin(firefox)
# 1.点击添加品牌按钮，品牌名称“苹果”。
adminMenu2(firefox,"商品管理","商品品牌")
firefox.find_element_by_partial_link_text("添加品牌").click()
firefox.find_element_by_id("brand_name").send_keys(shopname)
# 2.点击“保存品牌”按钮。保存成功
firefox.find_element_by_xpath("//button[@type='submit']").click()
time.sleep(3)

#断言
try:
    firefox.find_element_by_xpath("//td[contains(.,'%s')]"% shopname).is_displayed()
    writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()